package similan.br18.domain;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;

public class Organization implements Contact {

	private static final long serialVersionUID = -5024514100868534482L;
	private long id;
	private String legalName;
	private String title;
	private String email;
	private String address;
	
	/**
	 * @param legalName
	 * @param title
	 * @param email
	 * @param address
	 */
	public Organization(String legalName, String title, String email,
			String address) {
		super();
		setLegalName(legalName);
		setTitle(title);
		setEmail(email);
		setAddress(address);
	}

	public Organization() {
	}

	public String getLegalName() {
		return legalName;
	}

	public void setLegalName(String legalName) {
		this.legalName = legalName;
	}

	@Override
	public String getImagePath() {
		return null;
	}

	@Override
	public String getFullName() {
		return "Test Organization";
	}

	@Override
	public String getDetailInfo() {
		return "some detailed info";
	}

	@Override
	public ContactType getContactType() {
		return ContactType.Organization;
	}

	@Override
	public Set<? extends Contact> getContacts() {
		Set<Organization> orgs = new HashSet<Organization>();
		int size = new Random().nextInt(20) + 20;
		for (int i = 0; i < size; i++) {
			Organization organization = new Organization();
			organization.setLegalName(getFullName() + "_contact" + i);
			orgs.add(organization);
		}

		return orgs;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see similan.br18.domain.Contact#getFirstLetter()
	 */
	@Override
	public Character getFirstLetter() {
		return Character.toTitleCase(getFullName().charAt(0));
	}

	public long getId() {
		return this.id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
}
